package com.leilei.model;

import com.leilei.controller.Game;
import org.codehaus.jackson.annotate.JsonIgnore;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by yvdedu.com on 2016/11/14.
 */
public class Wall{
    private double face;
    private Point point;
    private AtomicInteger blood=new AtomicInteger(5);
    @JsonIgnore
    private MyBigBullet player;

    public Wall() {
    }

    public Wall(double face, Point point, AtomicInteger blood, MyBigBullet player) {
        this.face = face;
        this.point = point;
        this.blood = blood;
        this.player = player;
    }

    public double getFace() {
        return face;
    }

    public void setFace(double face) {
        this.face = face;
    }

    public Point getPoint() {
        return point;
    }

    public void setPoint(Point point) {
        this.point = point;
    }

    public int getBlood() {
        return blood.get();
    }

    public void setBlood(int blood) {
        this.blood.set(blood);
    }

    public MyBigBullet getPlayer() {
        return player;
    }

    public void setPlayer(MyBigBullet player) {
        this.player = player;
    }

    public void dropBlood(){
        this.blood.decrementAndGet();
        if (this.blood.get()<=0){
            Game.walls.remove(this);
        }
    }
    public void dropBlood(int i){
        this.blood.addAndGet(-i);
        if (this.blood.get()<=0){
            Game.walls.remove(this);
        }
    }
    public void recoveryBlood(int i){
        this.blood.addAndGet(i);
    }
    public void recoveryBlood(){
        this.blood.incrementAndGet();
    }
}
